import * as EmSDK from "./emSDK";
import { Tools } from 'weaver-mobile';
/**
 * 计算底部btn高度
 * @return {string}
 */
export const calcReqMainPaadingBottom = () => {
    //const {showBottomBtn = false} = base.allStores.wfOperateStore;
    const showBottomBtn = true;
    const clienttype = getClientType();
    const themeVars = window.getThemeVars();
    const {hd = 1} = themeVars;
    let paddingBottom = '0px';
    if ((clienttype == 'Webclient' || !EmSDK.judgeApiSupport('showBottomToolBar')) && showBottomBtn) {
        paddingBottom = `${hd * 45}px`;
    }
    return paddingBottom;
}
//获取客户端类型
export const getClientType = () => {
    const ua = Tools.mobileDetect().getUaInfo();
    const {isEmobile, mobile, os} = ua;
    let clienttype = 'Webclient';
    if (isEmobile) {
        clienttype = mobile;
        if (os == 'AndroidOS') {
            clienttype = 'Android';
        }
    }
    return clienttype;
}


export const controllBottomBtnDisable = (flag) => {
    //底部按钮禁用
    if(EmSDK.judgeApiSupport('userInteractionDisabled') && flag) {
        EmSDK.emClient.userInteractionDisabled({});
    }
    if(EmSDK.judgeApiSupport('userInteractionEnabled') && !flag) {
        EmSDK.emClient.userInteractionEnabled({});
    }
}